import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';

class HomeSwipe extends StatelessWidget {
  HomeSwipe({super.key, required this.swipeList});

  List swipeList = [];

  @override
  Widget build(BuildContext context) {
    return CarouselSlider(
      items: swipeList.map((item) {
        return Image.network(item['imgUrl']);
      }).toList(),
      options: CarouselOptions(
        // 缩放比例，不缩放
        viewportFraction: 1,
        // 高宽比
        aspectRatio: 375 / 185,
        // 自动播放
        autoPlay: true,
        // 播放时间
        autoPlayInterval: const Duration(seconds: 2),
      ),
    );
  }
}
